DevJourney

Python/VIT/sem-1/ex-14/3. String contains email/String contains email.py

import re

s = input("Enter statement: ")
res = re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', s)

if res:
    print("Valid email(s) found:")
    for email in res:
        print(email)
else:
    print("No valid email found.")
View on GitHub